﻿//-----------------------------------------------------------------------
// <copyright file="IEventInfoRepository.cs" company="SLWY Enterprises">
// * Copyright (C) 2017 四川商旅无忧科技有限公司 版权所有。
// * version : 1.0
// * author  : qinchaoyue
// * FileName: IEventInfoRepository.cs
// * history : created by qinchaoyue 2018-03-05 05:30:28
// </copyright>
//-----------------------------------------------------------------------

using System;
using Slwy.Data.Entity.Interfaces;
using Slwy.EventBus.Models;
using Slwy.FrameCore.Dependency;

namespace Slwy.EventBus.Interfaces
{
    /// <summary>
    /// 事件仓储
    /// </summary>
    public interface IEventInfoRepository: IScopeDependency
    {
        // Action<object> OnSetConnection { get; set; }

        IEditRepository<EventInfoEntity, string> EventInfoRepo { get; set; }

        /// <summary>
        /// 插入事件信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        bool InsertEventInfo<T>(IBaseRepository<T> repo, EventInfoEntity entity)
            where T : class, new ();

        /// <summary>
        /// 事件发送成功更新事件信息
        /// </summary>
        /// <param name="keyId"></param>
        /// <returns></returns>
        bool UpdateEventInfoForPosted<T>(IBaseRepository<T> repo, string keyId)
            where T : class, new ();

        /// <summary>
        /// 事件发送成功更新事件信息
        /// </summary>
        /// <param name="connectionString">数据库连接字符串</param>
        /// <param name="keyId">keyid</param>
        /// <returns></returns>
        bool UpdateEventInfoForPosted(string connectionString, string keyId);

        /// <summary>
        /// 更新异常信息
        /// </summary>
        /// <param name="connectionString"></param>
        /// <param name="keyId"></param>
        /// <returns></returns>
        bool UpdateEventInfoErrorMessage(string connectionString, string keyId, string errorMessage);
    }
}
